package com.meida.module.bus.provider.third.util;

import com.meida.module.bus.provider.third.entity.ChooseCourseRequestUrl;
import com.meida.module.bus.provider.utils.HttpUtils;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;

import java.util.HashMap;
import java.util.Map;

public class ChooseCourseUtils {

    public static void sendRequest() {
        try {
            Map<String, String> headers = new HashMap<>();
            Map<String, String> bodys = new HashMap<>();
            bodys.put("mobile", "15927323810");
            bodys.put("smsKey", "hOWt3hiakXHrePCqDKUsPz5T6f7j8P");
            HttpResponse httpResponse = HttpUtils.doPost("https://deren.dr009.com/api/user_get_smscode.rm", headers, null, bodys);
            System.out.println(httpResponse);
            String result = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
            System.out.println(result);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void sendRequest1() {
        try {
            Map<String, String> headers = new HashMap<>();
            Map<String, String> bodys = new HashMap<>();
            HttpResponse httpResponse = HttpUtils.doPost(ChooseCourseRequestUrl.serverName + ChooseCourseRequestUrl.getAllDepts, headers, null, bodys);
            System.out.println(httpResponse);
            String result = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        sendRequest1();
    }
}
